﻿<h1 class="right">قائمة الشركات</h1>
<span class="left grey medium margin-left11 margin-top5"><?php echo date('g:ia d/m/Y')?></span>
<div class="clear"></div>
<div id="co-dashboard-container">
        <?php
          $start = $page * 20 -19;
          $end  = $start + 19;
          if($end > $totalPages)
            $end = $totalPages
        ?>
		<table class="customers-table">
          <tr class="customers-table-head">
            	<td width="160px">الاسم</td>
                <td width="140px">الهاتف</td>
                <td width="100px">المدينة</td>
                <td width="160px">الشخص المسئول</td>
                <td width="160px">البريد الالكتروني</td>
                <td width="70px">الخصم</td>
                <td width="100px">العمليات</td>
            </tr>

            
                <?php if(!empty($clients)) { ?>
                <?php foreach($clients as $client) {
				$client_name = query("SELECT name from clients where id=?",$client['representative_id']); 
				?>
                <tr class="cell-parent">
                    <td ><?php echo $client['company_name']; ?> </td>
					<input type="hidden" id="#coid" value="$client['company_id']">
                    <td ><?php echo $client['company_phone']; ?>  </td>
                    <td ><?php echo $client['city'] ;?></td>
                    <td ><?php if(isset($client_name[0]['name']))echo $client_name[0]['name']; ?></td>
                    <td ><?php echo $client['company_email'] ;?></td>
                    <td ><?php echo $client['discount_for_company']; ?></td>
					<td><a href="./setcoprice.php?cid=<?php echo $client['company_id']; ?>" style="color:#14a6dd;">اختيار</a></td>
				</tr>
				<?php
				}
				}
				?>
						</table>
        <?php if(!empty($clients)) { ?>
        <div class="clear"></div>
        <div class="relative">
          <span class="middle xsmall showing-results absolute">عرض النتائج <?php echo $start; ?> - <?php echo $end; ?> من اجمالي <?php echo $totalPages; ?></span>
          <div id="page-selection"></div>
        </div>
        <div class="hidden totalPages"><?php if(isset($totalPages)) {echo $totalPages;} ?></div>
        <div class="hidden currentPage"><?php if(isset($page)) {echo $page;} ?></div>
        <?php } ?>

<div class="clear"></div>
</div>